<#include "/common/pagerForm.html">
<script type="text/javascript">
    function productOutputNavTabSearch(form) {
        var _value = $("select[name='status']",navTab.getCurrentPanel()).val();
        if(_value && _value=="2"){
            var days = $("input#days", navTab.getCurrentPanel()).val();
            if(!days || days == ''){
                alertMsg.info("<@label key='maybeOverdueData.M'>查询可能逾期的数据必须输入预警天数!</@label>");
                $("input#days", navTab.getCurrentPanel()).focus();
                return false;
            }
        }
        return navTabSearch($(form));
    }
    var panel=navTab.getCurrentPanel();
    $("select[name='status']",panel).change(function(){
        var $days=$("#days",panel);
        if($(this).val()==="2")
        {
            $days.removeAttr("readonly");
            $days.removeClass("readonly");
        }
        else
        {
            $days.val("");
            $days.attr("readonly","readonly");
            $days.addClass("readonly");
        }
    });
</script>
<form rel="pagerForm" method="post" action="" onsubmit="return productOutputNavTabSearch(this)">
<div class="pageHeader">
    <div class="searchBar">
        <div class="searchBar">
        <ul class="searchContent">
            <li ><label><@label key='productOrderNum.C,colon'>产品订单编号：</@label></label> <input type="text" name="productOrderNum" value="${condition.productOrderNum!''}"/></li>
            <li ><label><@label key='materialCode.C,colon'>物料编号：</@label></label> <input type="text" name="materialCode" value="${condition.materialCode!''}"/></li>
            <li ><label><@label key='materialText.C,colon'>物料名称：</@label></label> <input type="text" name="materialText" value="${condition.materialText!''}"/></li>
        </ul>
        <ul class="searchContent">
            <li ><label><@label key="workCenter.C,colon">工作中心：</@label></label>
                <input id="workCenterLookup.workCenterText" name="workCenterText" type="text"  value="${condition.workCenterText!''}" postField="workCenterCode"  value="${condition.workCenterText!''}" suggestFields="workCenterCode,workCenterText" 
                suggestUrl="${rc.getContextPath()}/manage/workCenter/workCenterSuggest" lookupGroup="workCenterLookup"/>
            </li>
            <li ><label><@label key='service_status.C,colon'>状态：</@label></label>
                <select name="status">
                    <option value=""><@label key='all.C'>所有</@label></option>
                    <option value="1" <#if condition.status?? && condition.status == '1'> selected</#if>> <@label key='overdueCompletion.C'>逾期未完成</@label></option>
                    <option value="0" <#if condition.status?? && condition.status == '0'> selected</#if>><@label key='normal.C'>正常</@label></option>
                    <option value="2" <#if condition.status?? && condition.status == '2'> selected</#if>><@label key='maybeOverdue.C'>可能逾期</@label></option>
                </select>
            </li>
            <li><label><@label key='warningDay.C,colon'>预警天数：</@label></label><input type="text" id="days" name="days" value="${condition.days!''}" <#if condition.status!="2"> readonly="readonly" </#if> /></li>
        </ul>
        <ul class="searchContent">
            <li><label><@label key='orderType.C,colon'>订单类型：</@label></label>
                <select name="orderTypeCode">
                    <option value="" ><@label key='all.C'>所有</@label></option>
                    <#if orderTypes??>
                        <#list orderTypes as orderType>
                            <option value="${orderType.orderTypeCode!''}" <#if condition.orderTypeCode?? && condition.orderTypeCode == orderType.orderTypeCode> selected</#if> >${orderType.orderTypeText!''}</option>
                        </#list>
                    </#if>
                </select>
            </li>
            <li>
                <img style="vertical-align:middle;" src="${rc.getContextPath()}/images/green-yuan.png" style="heigth: 20px;"/>--<@label key='normal.C'>正常</@label>&nbsp;&nbsp;
                <img style="vertical-align:middle;" src="${rc.getContextPath()}/images/red-yuan.png" style="heigth: 20px;"/>--<@label key='overdueCompletion.C'>逾期未完成</@label>&nbsp;&nbsp;
                <img style="vertical-align:middle;" src="${rc.getContextPath()}/images/yellow-yuan.png" style="heigth: 20px;"/>--<@label key='maybeOverdue.C'>可能逾期</@label>    
            </li>
            <li class="query">
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit"><@label key="query.B">查询</@label></button>
                    </div>
                </div>
            </li>
        </ul>
        </div>
    </div>
</div>
</form>

<div class="pageContent">

    <div class="panelBar">
        <ul class="toolBar">
            <@buttonRight menuCode="productOutput_exportToExcel" labelKey="add.B" defalutName="导出excel">
            <li><a class="export" href="${rc.getContextPath()}/manage/productOutput/exportToExcel" target="dwzExport" targetType="navTab" title="<@label key='confirmexportToExcel.M'>确定要导出这些记录吗?</@label>"><span><@label key="exportToExcel.D">导出EXCEL</@label></span></a></li>
            </@buttonRight>
            <@buttonRight menuCode="productOutput_view" labelKey="view.B" defalutName="详情">
            <li><a class="icon" target="dialog" mask="true" width="800" height="500" rel="producionOrderDetails_output"
            href="${rc.getContextPath()}/manage/productOutput/viewProductionOrderDetail?id={detailOutput_id}&navTabId=${navTabId!''}"><span><@label key="view.B">详情</@label></span></a></li></@buttonRight>
        </ul>
    </div>
    <table class="table" width="100%" layoutH="194">
        <thead>
            <tr>
                <th width="100" orderField="productionOrderNum" ><@label key='productionOrderNum.C'>生产订单编号</@label></th>
                <th width="80"><@label key='orderType.C'>订单类型</@label></th>
                <th width="100" ><@label key="workCenter.C">工作中心</@label></th>
                <th width="100"><@label key='materialCode.C'>物料编号</@label></th>
                <th width="100"><@label key='materialText.C'>物料名称</@label></th>
                <th width="80"><@label key='plannedQuantity.C'>计划数量</@label></th>
                <th width="80"><@label key='completedQuantity.C'>完工数量</@label></th>
                <th width="80"><@label key='plannedendDateTime.C'>计划截至时间</@label></th>
                <th width="80"><@label key='status.C'>状态</@label></th>
            </tr>
        </thead>
        <tbody>
        <#if page??><#if (page.data?size>0)> <#list page.data as detail>
            <tr target="detailOutput_id" rel="${detail.id!''}">
                <td>${detail.productionOrderNum!''}</td>
                <td>${detail.orderTypeText!''}</td>
                <td>${detail.workCenterText!''}</td>
                <td>${detail.materialCode!''}</td>
                <td>${detail.materialText!''}</td>
                <td>${detail.plannedQuantity!''}</td>
                <td>${detail.completedQuantity!''}</td>
                <td>${(detail.plannedendDateTime?string("yyyy-MM-dd HH:mm:ss"))?if_exists}</td>
                <td><#if detail.statusECode1?? && detail.statusECode1=='0'><img title="<@label key='normal.C'>正常</@label>" src="${rc.getContextPath()}/images/green-yuan.png" style="heigth: 20px;"/>
                <#else><#if detail.statusECode1?? && detail.statusECode1=='1'><img title="<@label key='overdueCompletion.C'>逾期未完成</@label>    " src="${rc.getContextPath()}/images/red-yuan.png" style="heigth: 20px;"/><#else><img title="<@label key='maybeOverdue.C'>可能逾期</@label>" src="${rc.getContextPath()}/images/yellow-yuan.png" style="heigth: 20px;"/></#if></#if></td>
            </tr>
        </#list>
        <#else>
        <tr target="detailOutput_id">
                <td colspan="8" class="noData">======<@label key='noListData.C'>列表无数据</@label>=====</font></td>
        </tr>
        </#if>
        <#else>
        <tr target="detailOutput_id">
                <td colspan="8" class="noData">======<@label key='noListData.C'>列表无数据</@label>=====</font></td>
        </tr>
        </#if>
        </tbody>
    </table>
        <#include "/common/panelBar.html">
</div>